<%@page import="javax.jdo.PersistenceManager,com.punegtug.opensocial.gifts.model.Gift,com.punegtug.opensocial.gifts.persistence.PMF,java.util.List" %>
<html>
<head>
</head>
<body>
<h1>Test HTTP GET on <b><u>/gifts</u></b> url</h1>
<a href="/gifts" target="_blank">Click here to see json string of all gifts</a>
<hr/>
<h1>Test HTTP POST on <b><u>/giftsTransaction</u></b> url</h1>
<form action="giftsTransaction" method="POST" target="_blank">
	<table>
		<tr>
			<td> Sender Id </td><td><input type="text" name="sender_id"/></td>
		</tr>
		<tr>
			<td> Receiver Id </td><td><input type="text" name="receiver_id"/></td>		
		</tr>
		<tr>
			<td> Gift </td>
			<td>
				<select name="gift_key" >
					<%
					PersistenceManager pMgr = PMF.get().getPersistenceManager();
					List<Gift> gifts = (List<Gift>) pMgr.newQuery(Gift.class).execute();
					StringBuilder strBuilder=new StringBuilder("[");
					for(Gift gift:gifts){
					%>
						<option value="<%=gift.getKey()%>"><%=gift.getName() %></option>
					<%
					}
					%>
				</select>			
			</td>
		</tr>
		<tr>
			<td><input type="submit"/></td>
			<td><input type="reset"/></td>
		</tr>
	</table>
</form>
<hr/>
<h1>Test HTTP GET on <b><u>/giftsTransaction</u></b> url providing a sender</h1>
Sender : <input id="senderText" type="text" name="sender_id" onchange="document.getElementById('senderURL').href='giftsTransaction?sender_id='+document.getElementById('senderText').value"/> :
<a id="senderURL" href="" target="_blank" >Click here to see json string of all gifts sent by Sender</a>
<hr/>
<h1>Test HTTP GET on <b><u>/giftsTransaction</u></b> url providing a receiver</h1>
Sender : <input id="receiverText" type="text" name="receiver_id" onchange="document.getElementById('receiverURL').href='giftsTransaction?receiver_id='+document.getElementById('receiverText').value"/> :
<a id="receiverURL" href="" target="_blank" >Click here to see json string of all gifts sent by Receiver</a>
<hr/>

</body>
</html>